package com.dongdongshop.mq;

import com.dongdongshop.service.ItemCatService;
import com.dongdongshop.service.ItemService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "my-consumer",topic = "cctv5")
public class ConsumeLinster implements RocketMQListener<Long> {
    @Autowired
    private ItemService itemService;

    @Override
    public void onMessage(Long l) {
        System.out.println("消息消费成功{}{}" + l);
        itemService.makeItem(l);
    }
}

